package movie.modle;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

/**
 * 模型层
 * @author 王荣
 *
 */
public class Movie {
	//标准javaBean
	private int id ;//影片ID
	private String name;//电影名
	private String director;//导演
	private String performer;//主演
	private String type;//类型
	private Date date;//上映时间
	private int clickRate;//点击率
	private int recommendRate;//推荐率
	
	
	public Movie() {
		
	}

	
	//用于用户上传、修改影片的有参构造
	public Movie(String name, String director, String performer, String type, Date date) {
		this.name = name;
		this.director = director;
		this.performer = performer;
		this.type = type;
		this.date = date;
	}


	public Movie(int id, String name, String director, String performer, String type, Date date, int clickRate,
			int recommendRate) {
		this.id = id;
		this.name = name;
		this.director = director;
		this.performer = performer;
		this.type = type;
		this.date = date;
		this.clickRate = clickRate;
		this.recommendRate = recommendRate;
	}


	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getDirector() {
		return director;
	}


	public void setDirector(String director) {
		this.director = director;
	}


	public String getPerformer() {
		return performer;
	}


	public void setPerformer(String performer) {
		this.performer = performer;
	}


	public String getType() {
		return type;
	}


	public void setType(String type) {
		this.type = type;
	}


	public Date getDate() {
		return date;
	}


	public void setDate(Date date) {
		this.date = date;
	}


	public int getClickRate() {
		return clickRate;
	}


	public void setClickRate(int clickRate) {
		this.clickRate = clickRate;
	}


	public int getRecommendRate() {
		return recommendRate;
	}


	public void setRecommendRate(int recommendRate) {
		this.recommendRate = recommendRate;
	}

	
	//将date转换成好看的格式
	public String showDate(){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
		return sdf.format(date);
	}
	

	//将影片信息装进字符串的方法
	public String showAll(){
		return name+director+performer+type;
	}
	
	
	@Override
	public String toString() {
		return id + "\t" + name + "\t" + director + "\t" + performer + 
				"\t"+ type + "\t" + showDate() + "\t" + clickRate + "\t" + recommendRate;
	}
	
		
}
